package com.bst.bsj.common.dal.ibatis;

import java.util.List;

import org.springframework.stereotype.Service;

import com.bst.bsj.common.dal.daointerface.PictureDAO;
import com.bst.bsj.common.dal.dataobject.Picture;
import com.sylinxsoft.tools.dao.impl.CommonBaseDAOImpl;

@Service("pictureDAO")
public class PictureDAOImpl extends CommonBaseDAOImpl implements PictureDAO {

  @Override
  public List<Picture> selectAll() {
    return (List<Picture>) this.getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_QUERY_PAGE");

  }

  @Override
  public void insert(Picture picture) {
    getSqlMapClientTemplate().insert(getNameSpace() + ".MS_INSERT", picture);
  }

  @Override
  public int delete(Long id) {
    return getSqlMapClientTemplate().delete(getNameSpace() + ".MS_DELETE", id);
  }

  @Override
  public void update(Picture picture) {
    getSqlMapClientTemplate().update(getNameSpace() + ".MS_UPDATE", picture);
  }

  @Override
  public Picture getPicture(Long id) {
    return (Picture) this.getSqlMapClientTemplate().queryForObject(getNameSpace() + ".MS_SELECT",id);

  }

}
